Skip to content

fix(builtins): unescape \/ in sed replacement strings#1028

Merged
chaliy merged 2 commits intomainfrom
fix/issue-959-sed-unescape-slash
Apr 3, 2026
Merged

fix(builtins): unescape \/ in sed replacement strings#1028
chaliy merged 2 commits intomainfrom
fix/issue-959-sed-unescape-slash

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 3, 2026

Summary

  • Fix sed builtin to properly unescape \/ in replacement strings, producing literal /
  • Also handles \\\, \n → newline, \t → tab in correct order using placeholder approach
  • Adds spec tests for slash unescaping, back-reference groups with slashes, and escaped backslash

Test plan

  • sed_unescape_slash_in_replacement\/ produces /
  • sed_regex_groups_with_slash — back-references with \/ in date reformatting
  • sed_escaped_backslash_in_replacement\\ produces \
  • All existing sed spec tests still pass
  • Smoke tested via CLI: echo "abc" | sed 's/b/\//'a/c

Closes #959

@chaliy chaliy merged commit d3521e6 into main Apr 3, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-959-sed-unescape-slash branch April 3, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sed builtin does not unescape \\/ in replacement strings

1 participant